﻿using AutoMapper;
using Project.DTO;
using Project.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Project.Common.AutoMapper
{
    public class MapperProfile : Profile
    {
        public MapperProfile()
        {
            //CreateMap<EmployerRegister, Employer>();  // 雇主
            CreateMap<BegoodatPost, BeGoodAt>();  // 擅长产品
            CreateMap<BeGoodatPut, BeGoodAt>().ReverseMap();
            CreateMap<UserPost, WebUser>();  // 用户
            CreateMap<UserDto, WebUser>().ReverseMap();
            CreateMap<UserPatch, WebUser>().ReverseMap();

            CreateMap<DesignToolPost, DesignTool>(); // 设计工具
            CreateMap<DesignToolPut, DesignTool>().ReverseMap();

            CreateMap<OrderPost, Order>().ReverseMap();  // 订单
            CreateMap<OrderDetailPost, OrderDetail>().ReverseMap();  //订单明细
            CreateMap<ToothPositionPost, ToothPosition>().ReverseMap(); //牙位
            CreateMap<OrderFilePost, OrderFiles>().ReverseMap();  // 订单附件

            CreateMap<WorkHistoryPost, WorkHistory>().ReverseMap();  // 工作建立
            CreateMap<WorkHistoryPut, WorkHistory>().ReverseMap();


            //CreateMap<SysPerson, SysPersonListDTO>()
            //    .ForMember(d => d.OrgName, s => s.MapFrom(m => m.Org.Name))
            //    .ForMember(d => d.Roles, s => s.MapFrom(m => m.Roles.Select(r => r.Name).ToArray()))
            //    .ReverseMap();
        }
    }
}
